$(function() {

    var sid = $(".row-list .clearfix a").data("sid");
    var cid = $(".row-list .clearfix a").data("cid");
    switch (cid) {
        case 0:
            timesId(sid);
            break;
        case 1:
            timesId(sid);
            break;
        case 2:
            themesId(sid);
            break;
        case 3:
            themesId(sid);
            break;
        case 4:
            daysId(sid);
            break;
        case 5:
            daysId(sid);
            break;
        default :
            return
    }

    $('.filter-nav .times .J_dd a').on('click', function() {
        var mid = $(this).data("mid");
        var tid = $('.filter-nav .themes .J_dd .on').data("tid");
        var did = $('.filter-nav .days .J_dd .on').data("did");
        $('.filter-nav .times .J_dd a').removeClass('on');
        $(this).addClass('on');
        $.post("/destination/getDestByScreening", {timesId:mid,themesId:tid,daysId:did}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    });

    $('.filter-nav .themes .J_dd a').on('click', function() {
        var tid = $(this).data("tid");
        var mid = $('.filter-nav .times .J_dd .on').data("mid");
        var did = $('.filter-nav .days .J_dd .on').data("did");
        $('.filter-nav .themes .J_dd a').removeClass('on');
        $(this).addClass('on');
        $.post("/destination/getDestByScreening", {timesId:mid,themesId:tid,daysId:did}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    });

    $('.filter-nav .days .J_dd a').on('click', function() {
        var did = $(this).data("did");
        var tid = $('.filter-nav .themes .J_dd .on').data("tid");
        var mid = $('.filter-nav .times .J_dd .on').data("mid");
        $('.filter-nav .days .J_dd a').removeClass('on');
        $(this).addClass('on');
        $.post("/destination/getDestByScreening", {timesId:mid,themesId:tid,daysId:did}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    });

    function timesId(timesId) {
        $.post("/destination/getDestByScreening", {timesId:timesId}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    }
    function themesId(themesId) {
        $.post("/destination/getDestByScreening", {themesId:themesId}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    }
    function daysId(daysId) {
        $.post("/destination/getDestByScreening", {daysId:daysId}, function (data) {
            $(".row-list .clearfix").empty();
            $(".row-list .clearfix").append(data);
        })
    }
});